from flask_sqlalchemy import SQLAlchemy
from marshmallow import Schema, fields

db=SQLAlchemy()



class User(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True)
    email = db.Column(db.String(120), unique=True)
    password = db.Column(db.String(120))
    sex = db.Column(db.Integer)

#     def __repr__(self):
#         return '<Dept %r>' % self.deptname
# def __init__(self,deptname):
#     self.deptname=deptname

class UserSchema(Schema):
  id= fields.Integer()
  username=fields.Str()
  email=fields.Str()
  password=fields.Str()
  sex=fields.Integer()

class Dept(db.Model):
    __tablename__ ='dept'
    id = db.Column(db.Integer,primary_key=True)
    deptname = db.Column(db.String(80),unique=True)
    location=db.Column(db.String(120))


    def __repr__(self):
        return '<Dept %r>' % self.deptname
    def __init__(self,deptname):
        self.deptname=deptname